// 提示文字
export const msg = (title, icon = 'none', duration = 3000) => {
	uni.showToast({
		title,
		icon,
		duration
	});
};
// 跳转页面
export const toPages = (url, type = '') => {
	if (!url || url.length == 0) {
		msg('地址不能为空')
	}
	switch (type) {
		case 'switchTab':
			uni.switchTab({
				url
			})
			break
		case "navigateBack":
			// 返回上一页
			uni.navigateBack({
				delta: query || 1
			})
			break
		case "redirectTo": //关闭当前页面
			uni.redirectTo({
				url
			})
			break
		case "reLaunch": //关闭所有页面
			uni.reLaunch({
				url
			})
			break
		default:
			uni.navigateTo({
				url,
				fail: function() {
					uni.switchTab({
						url: url
					})
					return true
				},
			})
	}
};